#!/bin/bash

usage()
{
        echo "USAGE : rmlogbak [ days ]"
}

if [ $# -eq 0 ] ; then
	DAYS=30
elif [ $# -eq 1 ] ; then
	DAYS=$1
fi

if [ ! -d  "${HOME}/logbak" ] ; then
	MKDIRLOGBAK="mkdir ${HOME}/logbak"
	echo ${MKDIRLOGBAK}
	${MKDIRLOGBAK}
fi

if [ ! -d "${HOME}/logbak" ] ; then
	exit 1;
fi

cd ${HOME}/logbak
find . -name "*.gz.tar" -mtime +${DAYS} -exec rm {} \; -print
